<template>
    <div>

        <el-row :gutter="20">
            <el-col :span="6">
                <div class="grid-content bg-purple">
                    <el-link type="primary" @click="goto('/ezuser')">用户</el-link>
                </div>
            </el-col>
            <el-col :span="6">
                <div class="grid-content bg-purple"></div>
            </el-col>
            <el-col :span="6">
                <div class="grid-content bg-purple"></div>
            </el-col>
            <el-col :span="6">
                <div class="grid-content bg-purple"></div>
            </el-col>
        </el-row>
    </div>
</template>

<script>


export default {
    data() {
        return {
            loading: false,
            form: {
                username: "",
                password: "",
            },
        };
    },
    methods: {
        goto(path) {
            this.$router.push({ path: path });
        },
        handleLogin() {
            this.$refs.loginForm.validate((valid) => {
                if (valid) {
                    this.loading = true;

                    console.log("11", md5(this.form.password));
                    // if (this.loginForm.rememberMe) {
                    //   Cookies.set("username", this.loginForm.username, { expires: 30 });
                    //   Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
                    //   Cookies.set("rememberMe", this.loginForm.rememberMe, { expires: 30 });
                    // } else {
                    //   Cookies.remove("username");
                    //   Cookies.remove("password");
                    //   Cookies.remove("rememberMe");
                    // }
                    this.$store
                        .dispatch("Login", {
                            username: this.form.username,
                            password: md5(this.form.password),
                        })
                        .then(() => {
                            this.$router.push({ path: this.redirect || "/home" }).catch(() => { });
                        })
                        .catch(() => {
                            this.loading = false;
                        });
                }
            });
        },
    },
};
</script>

<style scoped></style>